angular.module('merchant').controller('merchantController', function ($scope, $http, $rootScope) {
    //console.log('asdasd');
    //$rootScope.showCom = true;
    $http.get('/merchants')
        .then(function (res) {
            var data = res.data;
            if(data.msg == 'SUCCESS'){
                $scope.merchants = data.merchants;
                $scope.$emit('reDishes', data.dishes);
                //$scope.$broadcast('DishToCart',data.dishes);
            } else {
              console.error(data.error);
            }
        }, function (res) {
            console.error(res.data.error);
        })
});